import { useContext } from 'react'
import { Form, Select, Input, Button, Cascader } from 'antd'
import styles from './index.module.less'
import { context } from '../../_context'
import IconSvg from '@/components/IconSvg'

export default () => {
  const { filterParams, topConfig, manageParams } = useContext(context)
  const { filterForm } = filterParams
  return (
    <div className={styles.filterWrapper}>
      <Form className={styles.formWrapper} form={filterForm}>
        <Form.Item>
          <Cascader
            expandTrigger='hover'
            style={{ width: '200px', marginRight: '16px' }}
            options={topConfig.topWordSelectCascader}
            onChange={topConfig.getWardSelectValue}
            placeholder='请选择科室'
          />
        </Form.Item>
        <Form.Item>
          <Select
            onChange={topConfig.getLoginTimeValue}
            style={{ width: '200px', marginRight: '16px' }}
            placeholder='登录次数查询'
          >
            {topConfig.yearDatas.map((item: any) => (
              <Select.Option key={item.value} value={item.value}>
                {item.label}
              </Select.Option>
            ))}
          </Select>
        </Form.Item>
        <Form.Item>
          <Input
            onChange={(e: any) => {
              topConfig.getInputValue(e)
            }}
            suffix={<IconSvg name='search' />}
            onPressEnter={topConfig.inputEnter}
            style={{ width: '200px' }}
            placeholder='姓名/手机号'
          />
        </Form.Item>
      </Form>
      <div className={styles.btnWrapper}>
        {/* {manageParams.filterAddWardAdminButton() && ( */}
        <Button
          style={{ marginRight: '16px' }}
          icon={<IconSvg style={{ marginRight: '8px', width: 40, hieght: 40 }} name='add-admin' />}
          onClick={manageParams.clickAddWordAdminOpenModal}
        >
          新增病区管理员
        </Button>
        {/* )} */}

        <Button
          onClick={topConfig.exportDataClick}
          type='primary'
          icon={<IconSvg style={{ marginRight: '8px' }} name='lead-into' />}
        >
          导出
        </Button>
      </div>
    </div>
  )
}
